﻿// CRFoundation.cpp: 定义 DLL 应用程序的导出函数。
//

#include "stdafx.h"
#include "CRFoundation.h"

extern "C"
{
	static const size_t kBufferSize = 2048;

	void crDebugf(const char format[], ...)
	{
		char    buffer[kBufferSize + 1];
		va_list args;

		va_start(args, format);
		vprintf(format, args);
		va_end(args);
		// When we crash on Windows we often are missing a lot of prints. Since we don't really care
		// about SkDebugf performance we flush after every print.
		fflush(stdout);

		va_start(args, format);
#if defined(_MSC_VER) && _MSC_VER > 1400 
		vsnprintf_s(buffer, kBufferSize, format, args);
#else
		vsnprintf(buffer, kBufferSize, format, args);
#endif
		va_end(args);

		OutputDebugStringA(buffer);
	}

}
